package com.ryskoo.catering.orderlog.repository;

import com.ryskoo.catering.constant.HCLCacheConstant;
import com.ryskoo.catering.orderlog.domain.OrderLogPO;
import com.ryskoo.framework.core.repository.BasicRedisImpl;
import com.ryskoo.framework.core.utils.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * @author BeHappy
 */
@Primary
@Repository
public class OrderLogRedisImpl extends BasicRedisImpl<OrderLogPO> implements IOrderLogRepository {
    @Autowired
    private RedisUtil redisClient;
    @Autowired
    private IOrderLogRepository orderLogRepository;

    @PostConstruct
    public void init() {
        this.setRedisClient(redisClient);
        this.setDao(orderLogRepository);
    }

    public OrderLogRedisImpl() {
        super(HCLCacheConstant.HCL_ORDERLOG_KEY);
    }

    @Override
    public List<OrderLogPO> getLogListByOrderUuid(String orderUuid) {
        return orderLogRepository.getLogListByOrderUuid(orderUuid);
    }
}
